package com.illtamer.infinite.collapsar.autoconfigure;

import com.illtamer.infinite.collapsar.dispatcher.EmailSender;
import com.illtamer.infinite.collapsar.dispatcher.smtp.SMTPProxySender;
import com.illtamer.infinite.collapsar.dispatcher.smtp.SMTPSelfSender;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.mail.Message;

@Configuration
@ConditionalOnClass(Message.class)
@EnableConfigurationProperties(CollapsarProperties.class)
public class CollapsarAutoConfiguration {

    // TODO Add global properties which can be override later.
    @Bean
    public EmailSender getSelfEmailSender() {
        return new SMTPSelfSender();
    }

    // TODO Add global properties which can be override later.
    @Bean
    public EmailSender getProxyEmailSender() {
        return new SMTPProxySender();
    }

}
